
function register() {
    const userId = document.getElementById('userId').value;
    const password = document.getElementById('registerPassword').value;
    const userName = document.getElementById('userName').value;

    if (userId.trim()===''||userId.trim().length>10) {
        document.getElementById('errorMessage').innerHTML = '用户ID长度大于0小于10。';
        return false;
    }
    if(!/^\d+$/.test(userId.trim())){
        document.getElementById('errorMessage').innerHTML = '用户ID是数字。';
        return false;
    }
    if(userName.trim() === ''||userName.trim().length>10){
        document.getElementById('errorMessage').innerHTML = '用户昵称长度大于0小于10。';
        return false;
    }
    if (password.trim() === ''||password.trim().length>10) {
        document.getElementById('errorMessage').innerHTML = '用户密码长度大于0小于10。';
        return false;
    }
    return true;
}
